package org.qphoto;

import android.app.Activity;
import android.os.Bundle;
import android.widget.Toast;

public class AddUserDataActivity extends Activity {
	
	 @Override
	 public void onCreate(Bundle savedInstanceState) {
	        super.onCreate(savedInstanceState);
	        setContentView(R.layout.messageitem);
	        
	        CoreData coredata  = CoreData.getCoreData();
	        coredata.initDB(this);
	        
	        UserInfo user1 = new UserInfo();
	        user1.setUsername("ChunhuaLiu");
	        user1.setPassword("123456");
	        user1.setRealname("刘春华");
	        user1.setPhone("13418681906");
	        long u1id = coredata.getUserInfoDBHelper().InsertUserInfo(user1);
	        
	        UserInfo user2 = new UserInfo();
	        user2.setUsername("maoqin");
	        user2.setPassword("123456");
	        user2.setRealname("毛庆");
	        user2.setPhone("2342452323");
	        long u2id = coredata.getUserInfoDBHelper().InsertUserInfo(user2);
	        
	        UserInfo user3 = new UserInfo();
	        user3.setUsername("dahei");
	        user3.setPassword("123456");
	        user3.setRealname("大黑");
	        user3.setPhone("234252");
	        long u3id = coredata.getUserInfoDBHelper().InsertUserInfo(user3);
	        
	        
	        UserInfo user4 = new UserInfo();
	        user4.setUsername("xinyuan");
	        user4.setPassword("123456");
	        user4.setRealname("馨缘");
	        long u4id = coredata.getUserInfoDBHelper().InsertUserInfo(user4);
	        
	        UserInfo user5 = new UserInfo();
	        user5.setUsername("sasa");
	        user5.setPassword("123456");
	        user5.setRealname("莎莎");
	        long u5id = coredata.getUserInfoDBHelper().InsertUserInfo(user5);
	        
	        UserInfo user6 = new UserInfo();
	        user6.setUsername("feeling");
	        user6.setPassword("123456");
	        user6.setRealname("惠玲");
	        long u6id = coredata.getUserInfoDBHelper().InsertUserInfo(user6);
	        
	        UserInfo user7 = new UserInfo();
	        user7.setUsername("duxia");
	        user7.setPassword("123456");
	        user7.setRealname("杜夏");
	        long u7id = coredata.getUserInfoDBHelper().InsertUserInfo(user7);

	        coredata.getUserInfoDBHelper().AddFriend(u1id, u2id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u3id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u7id);
	        coredata.getUserInfoDBHelper().AddFriend(u2id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u2id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u3id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u4id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u3id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u5id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u5id, u7id);
	        coredata.getUserInfoDBHelper().AddFriend(u6id, u7id);
	        
	        UserInfo userinfo = coredata.getUserInfoDBHelper().GetUserInfo("dahei",
	        		"123456");
	        userinfo.getUserid();
	        
	        Toast.makeText(AddUserDataActivity.this,
					R.string.strPostOk,
					Toast.LENGTH_SHORT).show();
	 }
	 
	 public static void AddUser()
	 {
		 	CoreData coredata  = CoreData.getCoreData();
		 	UserInfo userinfo  = coredata.getUserInfoDBHelper().GetUserInfo("ChunhuaLiu", "123456");
	        if ( userinfo != null)
	        	return;
		 	
	        UserInfo user1 = new UserInfo();
	        user1.setUsername("ChunhuaLiu");
	        user1.setPassword("123456");
	        user1.setRealname("刘春华");
	        user1.setPhone("13418681906");
	        long u1id = coredata.getUserInfoDBHelper().InsertUserInfo(user1);
	        
	        UserInfo user2 = new UserInfo();
	        user2.setUsername("maoqin");
	        user2.setPassword("123456");
	        user2.setRealname("毛庆");
	        user2.setPhone("2342452323");
	        long u2id = coredata.getUserInfoDBHelper().InsertUserInfo(user2);
	        
	        UserInfo user3 = new UserInfo();
	        user3.setUsername("dahei");
	        user3.setPassword("123456");
	        user3.setRealname("大黑");
	        user3.setPhone("234252");
	        long u3id = coredata.getUserInfoDBHelper().InsertUserInfo(user3);
	        
	        
	        UserInfo user4 = new UserInfo();
	        user4.setUsername("xinyuan");
	        user4.setPassword("123456");
	        user4.setRealname("馨缘");
	        long u4id = coredata.getUserInfoDBHelper().InsertUserInfo(user4);
	        
	        UserInfo user5 = new UserInfo();
	        user5.setUsername("sasa");
	        user5.setPassword("123456");
	        user5.setRealname("莎莎");
	        long u5id = coredata.getUserInfoDBHelper().InsertUserInfo(user5);
	        
	        UserInfo user6 = new UserInfo();
	        user6.setUsername("feeling");
	        user6.setPassword("123456");
	        user6.setRealname("惠玲");
	        long u6id = coredata.getUserInfoDBHelper().InsertUserInfo(user6);
	        
	        UserInfo user7 = new UserInfo();
	        user7.setUsername("duxia");
	        user7.setPassword("123456");
	        user7.setRealname("杜夏");
	        long u7id = coredata.getUserInfoDBHelper().InsertUserInfo(user7);

	        coredata.getUserInfoDBHelper().AddFriend(u1id, u2id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u3id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u1id, u7id);
	        coredata.getUserInfoDBHelper().AddFriend(u2id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u2id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u3id, u5id);
	        coredata.getUserInfoDBHelper().AddFriend(u4id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u3id, u4id);
	        coredata.getUserInfoDBHelper().AddFriend(u5id, u6id);
	        coredata.getUserInfoDBHelper().AddFriend(u5id, u7id);
	        coredata.getUserInfoDBHelper().AddFriend(u6id, u7id);
	 }
}
